package csc.daonjpa.java.domain;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Entity class for Account table. This is a simple POJO class with annotations to define mapping with DB table
 */
@Entity
@Table(name = "customer")
public class Customer implements Serializable {
	private static final long serialVersionUID = 1L;
	
	@Id
	@Column(name = "id_customer")
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id;
	
	@Column(name = "accountnumber", unique = true)
	private String accountNumber;
	
	@Column(name = "loginid", unique = true)
	private String loginId;
	
	@Column(name = "password")
	private String password;
	
	@Column(name = "firstName")
	private String firstName;
	
	@Column(name = "lastName")
	private String lastName;
	
	@Column(name = "address")
	private String address;
	
	@Column(name = "phone")
	private String phone;
	
	@Column(name = "active")
	private boolean active;
	
	@Column(name = "amount")
	private long amount;
	
	@Column(name = "email")
	private String email;
	
	@Column(name = "loginFailedCount")
	private int failedCount;
	
	/**
	 * @return the failedCount
	 */
	public int getFailedCount() {
		return failedCount;
	}

	/**
	 * @param failedCount the failedCount to set
	 */
	public void setFailedCount(int failedCount) {
		this.failedCount = failedCount;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@OneToMany(mappedBy="sendCustomer")
	private List<Transaction> sendTransactionList;
	
	@OneToMany(mappedBy="receivedCustomer")
	private List<Transaction> receiveTransactionList;
	
	@OneToMany(mappedBy="cusLog")
	private List<Log> actionLog;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getAccountNumber() {
		return accountNumber;
	}

	public void setAccountNumber(String accountNumber) {
		this.accountNumber = accountNumber;
	}

	public String getLoginId() {
		return loginId;
	}

	public void setLoginId(String loginId) {
		this.loginId = loginId;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public boolean isActive() {
		return active;
	}

	public void setActive(boolean active) {
		this.active = active;
	}

	public long getAmount() {
		return amount;
	}

	public void setAmount(long amount) {
		this.amount = amount;
	}

	public List<Transaction> getSendTransactionList() {
		return sendTransactionList;
	}

	public void setSendTransactionList(List<Transaction> sendTransactionList) {
		this.sendTransactionList = sendTransactionList;
	}

	public List<Transaction> getReceiveTransactionList() {
		return receiveTransactionList;
	}

	public void setReceiveTransactionList(List<Transaction> receiveTransactionList) {
		this.receiveTransactionList = receiveTransactionList;
	}

	public List<Log> getActionLog() {
		return actionLog;
	}

	public void setActionLog(List<Log> actionLog) {
		this.actionLog = actionLog;
	}

	public Customer() {
		super();
	}

	public Customer(Long id, String accountNumber, String loginId,
			String password, String firstName, String lastName, String address,
			String phone, boolean active, long amount, String email,
			int failedCount, List<Transaction> sendTransactionList,
			List<Transaction> receiveTransactionList, List<Log> actionLog) {
		super();
		this.id = id;
		this.accountNumber = accountNumber;
		this.loginId = loginId;
		this.password = password;
		this.firstName = firstName;
		this.lastName = lastName;
		this.address = address;
		this.phone = phone;
		this.active = active;
		this.amount = amount;
		this.email = email;
		this.failedCount = failedCount;
		this.sendTransactionList = sendTransactionList;
		this.receiveTransactionList = receiveTransactionList;
		this.actionLog = actionLog;
	}

	
	
}